<!--
 * @Author: your name
 * @Date: 2019-10-22 09:06:18
 * @LastEditTime: 2019-10-31 11:07:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /e:\yjp\my_test\vue_plugins\src\views\Websocket.vue
 -->
<template>
<div class="container">
    <van-nav-bar title="$root" left-arrow fixed :border="false"
      @click-left='$router.push("/")'/>
      
    <van-cell-group>
        <van-field
            v-model="rootname"
            label="name"
            placeholder="请输入"
        />
        <van-field
            v-model="rootvalue"
            label="value"
            placeholder="请输入"
        />
        <van-cell title="查看$root.global全局数据" value="" is-link to="/globaldata"/>
    </van-cell-group>

</div>
</template>
<script>
import { log } from 'util';
export default {
    name:"Global",
    data(){
        return{
            rootname:'',
            rootvalue:'',
        }
    },
    mounted(){
        this.rootname = Object.keys(this.$root.global)[0];
        this.rootvalue = Object.values(this.$root.global)[0];
    },
    destroyed(){
        let obj = {
            [this.rootname]:this.rootvalue
        }
        this.$root.global = {...obj};
    }
}
</script>

<style lang="less" scoped>

</style>